﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using ThangNM_Client.EntityObject;
using ThangNM_Client.SharedLibraries;
using ThangNM_LIB.DB;
using ThangNM_LIB.FUNC;

namespace ThangNM_Client.DataAccessObject
{
    public class BuildWebDAO : SQLiteDataProvider
    {
        public override Boolean bWriteLog { get { return false; } set { } }
        public override String sConnectionStrings { get { return ConstEx.connectionStrings.connSqLite_FB; } set { } }

        public BuildWebDAO(Boolean _bWriteLog = true, String _sConnectionStrings = ConstEx.connectionStrings.connSqLite_FB)
        {
            this.bWriteLog = _bWriteLog;
            this.sConnectionStrings = _sConnectionStrings;
        }

        public Boolean DuongNTH_InsertItem(String email, Boolean status)
        {
            String sQuery = String.Format("INSERT INTO tblDuongNTH(email,status) SELECT '{0}', '{1}' ", email, status ? "1" : "0");
            sQuery = NullEx.getNullValueSQLite(sQuery);
            SqlCommand cmd = new SqlCommand(sQuery);
            cmd.CommandType = CommandType.Text;
            return ExecuteNonQuery(cmd);
        }

        //public Boolean InsertItem(BuildWebEO objWeb)
        //{
        //    String sQuery = String.Format(QuerySQLiteLIB.BuildWeb.InsertItem, objWeb.sPath, objWeb.sDescription, objWeb.bContent, objWeb.iType, objWeb.bStatus ? "1" : "0");
        //    sQuery = NullEx.getNullValueSQLite(sQuery);
        //    SqlCommand cmd = new SqlCommand(sQuery);
        //    cmd.CommandType = CommandType.Text;
        //    return ExecuteNonQuery(cmd);
        //}

        //public DataTable SelectList()
        //{
        //    DataTable dt = new DataTable();
        //    String sQuery = String.Format(QuerySQLiteLIB.BuildWeb.SelectList);
        //    sQuery = NullEx.getNullValueSQLite(sQuery);
        //    using (SqlCommand cmd = new SqlCommand(sQuery))
        //    {
        //        cmd.CommandType = CommandType.Text;
        //        dt = GetDataTable(cmd);
        //    }
        //    return dt;
        //}

        //public BuildWebEO SelectItem(Int32 PK_iWID)
        //{
        //    BuildWebEO objRet = new BuildWebEO();
        //    String sQuery = String.Format(QuerySQLiteLIB.BuildWeb.SelectItem, PK_iWID);
        //    sQuery = NullEx.getNullValueSQLite(sQuery);
        //    using (SqlCommand cmd = new SqlCommand(sQuery))
        //    {
        //        cmd.CommandType = CommandType.Text;
        //        objRet = BuildWebDO(GetDataTable(cmd));
        //    }
        //    return objRet;
        //}

        //public BuildWebEO BuildWebDO(DataTable input)
        //{
        //    List<BuildWebEO> lst = new List<BuildWebEO>();
        //    lst = (List<BuildWebEO>)ConvertEx.ConvertDataTableToListObject<BuildWebEO>(input, lst.GetType());
        //    if (CommonsCheck.ListObject_OK(lst))
        //        return lst[0];
        //    else
        //        return null;
        //}
    }
}
